<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Services\Guzzle;
use Illuminate\Http\Request;

class AccountController extends Controller
{
    public function queryAccount(Request $request)
    {
        $requestData = $request->input();
        $keyword = $requestData['keyword'];
        $query = array();
        if ($keyword) {
            $query['keyword'] = $keyword;
        }
        $Auth = new AuthController();
        $token = $Auth->getToken();
        $Guzzle = new Guzzle();
        $data = $Guzzle->guzzle_get(config('app.boss_api_url'), '/v2/merchant/agent_query', [
            'Content-type' => 'application/json',
            'Authorization' => $token
        ], $query);
       
        return $data;

    }

    public function getAccountDetail()
    {
        $keyword = $_GET['keyword'];
        $query = array();
        if ($keyword) {
            $query['keyword'] = $keyword;
        }
        $Auth = new AuthController();
        $token = $Auth->getToken();
        $Guzzle = new Guzzle();
        $data = $Guzzle->guzzle_get(config('app.boss_api_url'), '/v2/merchant/agent_query', [
            'Content-type' => 'application/json',
            'Authorization' => $token
        ], $query);
        return $data;
    }
}